package org.itboys.store.dto;

/**
 * Created by huml on 2016/5/18.
 * 确认订单页面的产品数据结构
 */
public class ConfirmProductDto {

    private Long productId;//产品id
    private String productName;//产品名称
    private String productImage;//产品主图
    private Double price;//售价
    private int num;//数量
    private int codeFee;//邮费
    private String deliveryMethod;//配送方式
    private Integer type;

    private Long carId;//对应的购物车里的id

    public ConfirmProductDto(){}

    public ConfirmProductDto(ProductDetail detail, int num, Integer postFee, Integer manPostFee){
        this.productId = detail.getId();
        this.productName = detail.getTitle();
        this.productImage = detail.getImageUrl();
        this.num = num;
        this.type = detail.getType();
        if(detail.getRealPrice() >= manPostFee){//满足包邮条件
            this.price = detail.getRealPrice();
            this.codeFee = 0;
        } else {
            this.price = detail.getRealPrice() + postFee;
            this.codeFee = detail.getPostage();
        }
        this.deliveryMethod = detail.getStorage();
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getProductImage() {
        return productImage;
    }

    public void setProductImage(String productImage) {
        this.productImage = productImage;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getCodeFee() {
        return codeFee;
    }

    public void setCodeFee(int codeFee) {
        this.codeFee = codeFee;
    }

    public String getDeliveryMethod() {
        return deliveryMethod;
    }

    public void setDeliveryMethod(String deliveryMethod) {
        this.deliveryMethod = deliveryMethod;
    }

    public Long getCarId() {
        return carId;
    }

    public void setCarId(Long carId) {
        this.carId = carId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }
}
